package com.ybwh.springboot2.controller;

import com.ybwh.springboot2.common.mybatis.plus.page.PageInfo;
import com.ybwh.springboot2.common.mybatis.plus.page.PageParam;
import com.ybwh.springboot2.common.mybatis.plus.page.PageRecords;
import com.ybwh.springboot2.exmple.entity.Dict;
import com.ybwh.springboot2.exmple.mapper.DictMapper;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;

import javax.annotation.Resource;

/**
 * <p>
 * 登录逻辑的控制器
 * </p>
 *
 * @author fanbeibei
 * @version V1.0
 * @since 2019/12/20 21:51
 */
@Slf4j
@Controller
@RequestMapping("/")
@Api(tags = "数据字典")
public class DictController {
    @Resource
    private DictMapper dictMapper;

    @ApiOperation(value = "分页查询")
    @RequestMapping("/selectByPage")
    public PageRecords<Dict> selectByPage(PageParam<Dict> param) {
        PageInfo<Dict> pageInfo = dictMapper.selectByPage(param.toPageInfo(), param.getQueryCondition());

        return PageRecords.fromPageInfo(pageInfo);
    }


}
